/*
 * PlaylistedApp.java
 */

package guiPlaylisted;

import controlPlaylisted.UserController;
import controlPlaylisted.MusicController;
import controlPlaylisted.PlaylistController;

import java.io.FileNotFoundException;
import java.io.IOException;
import org.jdesktop.application.Application;
import org.jdesktop.application.SingleFrameApplication;





/**
 * The main class of the application.
 */
public class PlaylistedApp extends SingleFrameApplication {

    private static UserController m_userController;

    private static MusicController m_musicController;

    private static PlaylistController m_playlistController;

    /**
     * At startup create and show the main frame of the application.
     */
    @Override protected void startup() {
        show(new PlaylistedView(this));
    }

    /**
     * This method is to initialize the specified window by injecting resources.
     * Windows shown in our application come fully initialized from the GUI
     * builder, so this additional configuration is not needed.
     */
    @Override protected void configureWindow(java.awt.Window root) {
    }

    /**
     * A convenient static getter for the application instance.
     * @return the instance of PlaylistedApp
     */
    public static PlaylistedApp getApplication() {
        return Application.getInstance(PlaylistedApp.class);
    }

    /**
     * Main method launching the application.
     */
    public static void main(String[] args) throws FileNotFoundException, IOException, ClassNotFoundException {

        m_userController = UserController.getInstance();
        m_userController.loadUserList();
        m_userController.setUserView();

        m_musicController = MusicController.getInstance();
        m_musicController.loadMusicList();

        m_playlistController = PlaylistController.getInstance();
        m_playlistController.setMusicCtrl();
        m_playlistController.setUserCtrl();

        m_userController.setPlaylistCtrl();
        
        m_playlistController.loadPlaylistList();       

        launch(PlaylistedApp.class, args);
    }

    public static UserController getUserCtrl(){
        return m_userController;
    }

    public static MusicController getMusicCtrl(){
        return m_musicController;
    }

    public static PlaylistController getPlaylistCtrl(){
        return m_playlistController;
    }


}
